module.exports = {
    userslist : function(){
        this.users = {};
        
        this.init = function(){ return true; }
        
        this.addUser = function(pub_id, data, results){
            if (pub_id) {
                this.users[pub_id] = {};
                this.users[pub_id]['nickname'] = data.NICKNAME;
                if (results) {
                    this.users[pub_id]['sexe'] = results['sexe'];
                    this.users[pub_id]['birthday'] = results['birthday'];
                    this.users[pub_id]['color'] = results['color'];
                    this.users[pub_id]['group_id'] = results['group'];
                }
            }
        }
        
        this.deleteUser = function(pub_id){
            delete(this.users[pub_id]);
        }
        
        this.usersList = function(){
            return this.users;
        }
        
        this.getUser = function(pub_id){
            return this.users[pub_id];
        }
        
        this.getUserProperty = function(pub_id, propertyName){
            return this.users[pub_id][propertyName];
        }
    }
}